package cn.sc.allinpay.allfavour.business.setpwd;

import com.alibaba.fastjson.JSONObject;

import cn.pai.mvp.callback.MpCallBack;
import cn.sc.allinpay.allfavour.base.connect.http.AppRequest;
import cn.sc.allinpay.allfavour.base.connect.http.RequestManager;
import cn.sc.allinpay.allfavour.base.model.BaseModel;

/**
 * 登录密码修改
 * author：pany
 * on 2017/12/5 14:44
 */
public class SetPwdModel extends BaseModel {

    public void reqLoginPwdModify(String oriPsw, final String newPsw, final MpCallBack<JSONObject, String> mpCallBack) {
        RequestManager.reqLoginPwdUpd(oriPsw, newPsw, new AppRequest.RequestCall() {
            @Override
            protected void onSuccess(JSONObject response) {
                getGlobal().getCashierData().setPassword(newPsw);
                mpCallBack.onSuccess(response);
            }

            @Override
            public void onFailure(JSONObject response, String message) {
                mpCallBack.onFailure(response != null ? response.toString() : null, message);
            }
        });
    }
}
